﻿using CNKI.TPI.Web.Search.Model;
using KNet.Data.Entity;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;

namespace CNKI.TPI.Web.Search.IDAO
{
    public interface ICommonDAO
    {
        /// <summary>
        /// 
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="match"></param>
        /// <returns></returns>
        IList<T> Get<T>(Expression<Func<T, bool>> match, Expression<Func<T, bool>> order = null) where T : BaseModel, IView, new();

        /// <summary>
        /// 
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="match"></param>
        /// <returns></returns>
        IList<T> GetAll<T>(Expression<Func<T, bool>> order = null) where T : BaseModel, IView, new();

        /// <summary>
        /// 
        /// </summary>
        /// <param name="sql"></param>
        /// <returns></returns>
        bool ExecuteNonQuery(string sql);

        /// <summary>
        /// 
        /// </summary>
        /// <param name="sql"></param>
        /// <returns></returns>
        DataTable ExecuteSql(string sql);
    }
}
